﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;

namespace AlphaSolutionsGP.Demo_classes
{
    class StaffDemo
    {
        private Staff _staff1;
        private Staff _staff2;
        private int _pass;
        private int _fail;

        public StaffDemo()
        {
            _pass = 0;
            _fail = 0;
            if (testStaffNoArgConstructor() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testStaffArgConstructor() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testCreateStaff() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testAmmendStaff() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
            if (testDeleteStaff() == false)
            {
                _fail++;
            }
            else
            {
                _pass++;
            }
        
        }

        bool testStaffNoArgConstructor()
        {
            bool success = false;
            try
            {
                _staff1 = new Staff();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testStaffArgConstructor()
        {
            bool success = false;
            try
            {

                _staff2 = new Staff("99100813", "Joe", "Mathew", "bloggs", "01-10-1992", "test", "test", "123 fake street", "co8 7dj", "madeupville", "01928736478", "01928903902", "Joe.Bloggs@aol.com", "ML/PT", "01-10-1992", "01-10-1992", "Dormant", "fired", "test");
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testCreateStaff()
        {
            bool success = false;
            try
            {
                Staff2.createStaff();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testAmmendStaff()
        {
            bool success = false;
            try
            {
                Staff2.FirstName = "Ammendedstaff";
                Staff2.amendStaff();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testDeleteStaff()
        {
            bool success = false;
            try
            {
                Staff2.deleteStaff();
                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
        }
        bool testGetters()
        {
            bool success = false;
            try
            {
                string name = Staff2.FirstName;
                string role = Staff2.Role;
                string city = Staff2.City;

                success = true;
            }
            catch (Exception e)
            {
                success = false;
            }
            return success;
            
        }










        public int Fail
        {
            get { return _fail; }
            set { _fail = value; }
        }
        
        public int Pass
        {
            get { return _pass; }
            set { _pass = value; }
        }
        

        public Staff Staff2
        {
            get { return _staff2; }
            set { _staff2 = value; }
        }
        
        public Staff Staff1
        {
            get { return _staff1; }
            set { _staff1 = value; }
        }
        
    }
}
